package com.jg.xmlSchema2JsonSchema.xsd;

import java.util.List;

import com.jg.xmlSchema2JsonSchema.XmlUtil;
import org.w3c.dom.Element;


/**
 * @author czg
 */
public class XsAnnotation {
    private Element element;
    private String text;

    public XsAnnotation(Element element) {
        this.element = element;
        getData();
    }

    private void getData() {
        List<Element> elementList = XmlUtil.getChildElements(element, XMLConstants.XSD_DEFAULT_NAMESPACE + ":" + XMLConstants.XSD_DOCUMENTATION);
        if (elementList.size() > 0) {
            text = elementList.get(0).getTextContent();
        }
    }

    public String getText() {
        return text;
    }

    public Element getXmlElement() {
        return element;
    }
}
